﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;


public class MovingRooksDiv2
{
    public string move(int[] Y1, int[] Y2)
    {

        return "Impossible";
    }
}

public class LongWordsDiv2
{
    public string find(string word)
    {
        SortedList<char, List<int>> chPosList = new SortedList<char, List<int>>();

        char prevCh = ' ';
        for (int i = 0; i < word.Length; i++)
        {
            char ch = word[i];
            if ( !chPosList.ContainsKey(ch) ) chPosList[ch] = new List<int>(); 
            chPosList[ch].Add(i);

            if ( prevCh == ch ) return "Dislikes";
            prevCh = ch;
        }


        List<char> dCharList = new List<char>();
        foreach (var kv in chPosList)
        {
            if (kv.Value.Count > 1)
            {
                dCharList.Add(kv.Key);
            }
        }

        char[] dCharArray = dCharList.ToArray();

        for (int i = 0; i < dCharArray.Length; i++)
        {
            List<int> lPosList = chPosList[dCharArray[i]];
            for (int j = i + 1; j < dCharArray.Length; j++)
            {
                List<int> rPosList = chPosList[dCharArray[j]];

                SortedList<int, char> mPosList = new SortedList<int, char>();
                foreach (int lpos in lPosList)
                {
                    mPosList.Add(lpos, 'a');
                }
                foreach (int rpos in rPosList)
                {
                    mPosList.Add(rpos, 'b');
                }
                int status = 0;
                foreach (var kv in mPosList)
                {
                    if (status == 0)
                    {
                        if (kv.Value == 'a') status = 1;
                    }
                    else if (status == 1)
                    {
                        if (kv.Value == 'b') status = 2;
                    }
                    else if (status == 2)
                    {
                        if (kv.Value == 'a') status = 3;
                    }
                    else if (status == 3)
                    {
                        if (kv.Value == 'b') return "Dislikes";
                    }
                }
            }
        }

        return "Likes";
    }
}

public class WritingWords
{
    public int write(string word)
    {
        int cnt = 0;
        for (int i = 0; i < word.Length; i++)
        {
            cnt += word[i] - 'A' + 1;
        }

        return cnt;
    }
}
